<template>
	<view>
		<view class="tr flex w8 text-left">
			<view class="flex3 blod">姓名:</view>
			<view class="flex7 text-left">{{info.name}}</view>
		</view>
		<view class="divider"></view>
		<view class="tr flex w8 text-left">
			<view class="flex3 blod">性别:</view>
			<view class="flex7 text-left">{{info.gender}}</view>
		</view>
		<view class="divider"></view>
		<view class="tr flex w8 text-left">
			<view class="flex3 blod">身份证号:</view>
			<view class="flex7 text-left">{{info.idCard}}</view>
		</view>
		<view class="divider"></view>
		<view class="tr flex w8 text-left">
			<view class="flex3 blod">出生年月:</view>
			<view class="flex7 text-left">{{info.birthday}}</view>
		</view>
		<view class="divider"></view>
		<view class="tr flex w8 text-left">
			<view class="flex3 blod">申请时间:</view>
			<view class="flex7 text-left">{{info.time}}</view>
		</view>
		<view class="divider"></view>
		<view class="tr flex w8 text-left">
			<view class="flex3 blod">银行卡号:</view>
			<view class="flex7 text-left">{{info.bankNum}}</view>
		</view>
		<view class="divider"></view>
		<view class="tr flex w8 text-left">
			<view class="flex3 blod">开户行:</view>
			<view class="flex7 text-left">{{info.bank}}</view>
		</view>
		<view class="divider"></view>
		<view class="tr flex w8 text-left">
			<view class="flex3 blod">户籍地址:</view>
			<view class="flex7 text-left">{{info.huji}}</view>
		</view>
		<view class="divider"></view>
		<view class="tr flex w8 text-left">
			<view class="flex3 blod">现居地址:</view>
			<view class="flex7 text-left">{{info.xianju}}</view>
		</view>
		<view v-if="lv != 3" class="divider"></view>
		<view v-if="lv != 3" class="tr flex w8 text-left">
			<view class="flex3 blod">是否通过:</view>
			<view class="flex7 text-left">
				<check-box @changeCheck="changeCheck"></check-box>
			</view>
		</view>

		<view v-if="lv != 3" class="divider"></view>
		<view v-if="lv != 3 && !isOk" class="tr flex w8 text-left">
			<view class="flex3 blod">错误信息:</view>
			<view class="flex7 text-left">
				<check-box @changeCheck="changeError" :maxChoice="wrongType.length" :list="wrongType" choiceColor="#FF6B6B" flex="longitudinal"></check-box>
			</view>
		</view>

		<view v-if="lv != 3" class="divider"></view>
		<view v-if="lv != 3" class="tr flex w8 text-left">
			<view class="flex3 blod">反馈意见:</view>
			<view class="flex7 text-left">
				<textarea @input="setOpin" :value="opinion" class="w10" style=" height: 200rpx; display: block;"></textarea>
			</view>
		</view>

		<view v-if="lv != 3">
			<view style="margin: 15rpx auto; width: 140rpx; height: 10rpx;">
				<butt @clickButt="submit" :bgc="bgc" content="提交"></butt>
			</view>
		</view>
	</view>
</template>
<script>
	import imgSlide from "../../components/ui/tg-img-slide.vue"
	import butt from '../../components/ui/myButt.vue'
	import slideChoice from '../../components/ui/tg-slide.vue'
	import checkBox from '../../components/ui/tg-checkbox.vue'
	export default {
		components: {
			butt,
			imgSlide,
			slideChoice,
			checkBox
		},
		computed: {
			linH: {
				get() {
					if (this.title.length > 18) {
						return 40
					} else {
						return 80
					}
				}
			}
		},
		props: {
			lv: {

			},
			info: {

			}
		},
		data() {
			return {
				opinion: '',
				isOk: true,
				title: "安徽省滁州市凤阳县府城镇府东社区委员会l栋2单—",
				bgc: '#33B0FF',
				isAllow: [{
					content: '通过',
					check: false
				}, {
					content: '不通过',
					check: false
				}],
				wrongType: [{
					content: '户籍地不符',
					check: false
				}, {
					content: '银行账号未按规定提交',
					check: false
				}, {
					content: '材料不全',
					check: false,
					childMax: 4,
					child: [{
						content: '身份证正面照',
						check: false
					}, {
						content: '身份证反面照',
						check: false
					}, {
						content: '户口本照',
						check: false
					}, {
						content: '身份证号',
						check: false
					}]
				}]
			}
		},
		onLoad() {},
		methods: {
			setOpin(e) {
				this.opinion = e.detail.value
			},
			changeError(e) {
				this.wrongType = e
				console.log(this.wrongType)
			},
			changeChoice(e) {
				console.log(e)
				if (e.index == 0) {
					this.bgc = '#33B0FF'
				} else {
					this.bgc = '#FF6B6B'
				}
				// this.$emit('changeChoice', e)
			},
			changeCheck(e) {
				console.log(e)
				this.isAllow = e
				var isOk = e[1].check ? false : true
				if (isOk) {
					this.bgc = '#33B0FF'
				} else {
					this.bgc = '#FF6B6B'
				}
				this.isOk = isOk
				return isOk
				// this.changeCheck({index})
			},
			async submit() {
				var res = this.wrongType
				var ma = []
				if (res[2].check) {
					var child = res[2].child;
					child.forEach((e, i) => {
						if (e.check) {
							ma.push(i + 1)
						}
					})
				}
				var infoUser = uni.getStorageSync('info') || ' '
				var aa = {
					"checkInfo": {
						"domicile": res[0].check,
						"inComMaterials": res[2].check,
						"bankCardMatch": res[1].check,
						"ma": ma
					},
					"opinion": this.opinion
				}
				var data = {
					"handleOpinion": JSON.stringify(aa),
					"handleType": this.isOk ? '2' : '3',
					"handleUserId": infoUser.user.id,
					"processId": this.info.pid
				}
				console.log(data)
				console.log(this.info)
				var result = await this.$api.pushCommit(data);
				if (result.data.code == 200) {
					uni.showModal({
						title: '提示',
						content: '审核已提交！',
						success() {
							uni.navigateBack({

							})
						}
					})
				} else if (result.data.code == 1004) {
					uni.showModal({
						title: '提示',
						content: '您已审核通过，不可重复审核！',
						success() {
							uni.navigateBack({

							})
						}
					})
				} else {
					uni.showModal({
						title: '提示',
						content: '网络错误！请稍后重试！',
						success() {
							uni.navigateBack({

							})
						}
					})
				}
			}

		}
	}
</script>
<style scoped>
	.tr {
		margin: 20rpx auto;
		font-size: 35rpx;
	}

	.divider {
		width: 85%;
		height: 1rpx;
		background-color: #666666;
		margin: 0 auto;
	}
</style>
